package com.riamm.ui {
  import flash.events.MouseEvent;
  /**
   * @author Saber
   */
  public class AbstractButton extends Component {
    //==========================================================================
    //  Constructor
    //==========================================================================
    public function AbstractButton(xpos:int = 0, ypos:int = 0) {
      super(xpos, ypos);
    }
    //==========================================================================
    //  Overridden methods
    //==========================================================================
    override public function destroy():void {
      removeEvent();
    }
    //==========================================================================
    //  Protected methods
    //==========================================================================
    protected function addEvent():void {
      addEventListener(MouseEvent.ROLL_OVER, rollOverHandler);
      addEventListener(MouseEvent.ROLL_OUT, rollOutHandler);
      addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
      addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    }
    protected function removeEvent():void {
      removeEventListener(MouseEvent.ROLL_OVER, rollOverHandler);
      removeEventListener(MouseEvent.ROLL_OUT, rollOutHandler);
      removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
      removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
    }
    //==========================================================================
    //  Event handlers
    //==========================================================================
    private function rollOutHandler(event:MouseEvent):void {}
    private function rollOverHandler(event:MouseEvent):void {}
    private function mouseDownHandler(event:MouseEvent):void {}
    private function mouseUpHandler(event:MouseEvent):void {}
  }
}
